avatar
avatar
This report aims to analyze the changes in the victims of various crimes in Australia from 2010 to 2019. We hope to find some problems by analyzing the data: From the perspective of state, gender and age, how have the victims of various crimes changed in the past ten years?
The report is based on victim data from the Australian Bureau of Statistics. It is a data set generated by regular judicial and criminal investigations and aims to provide the number and rate of victims across Australia in terms of state, gender and age. All ABS data displayed on this website are provided under the Creative Commons Attribution 4.0 international license. It is open data and can be shared freely and adapted for any purpose.
Team12 Researchers:
Comparison of the number of victims of various crimes in each state in the same year
Rate of change in the number of victims of various crimes by state
| State | robbery_rate | robbery_change | Sexual assault_rate | Sexual assault_change | Murder_rate | Murder_change |
|---|---|---|---|---|---|---|
| Capital | -19.867550 | -30 | 69.430052 | 134 | -100.000000 | -3 |
| NewSouthWales | -43.953488 | -945 | 51.451369 | 3740 | 4.109589 | 3 |
| Northern Territory | 43.478261 | 20 | 7.926829 | 26 | -9.090909 | -1 |
| Queensland | 73.246753 | 564 | 14.626091 | 620 | -2.083333 | -1 |
| South Australia | -34.482759 | -180 | 13.719736 | 187 | -33.333333 | -5 |
| Tasmania | 1.176471 | 1 | 9.604520 | 17 | -33.333333 | -2 |
| Victoria | 40.751043 | 586 | 60.622761 | 2200 | 19.148936 | 9 |
| Western Australia | 13.358071 | 72 | 67.412334 | 1115 | -10.000000 | -3 |
| State | extortion_rate | extortion_change | Manslaughter_rate | Manslaughter_change | Kidnapping_rate | Kidnapping_change |
|---|---|---|---|---|---|---|
| Capital | Inf | 6 | NaN | 0 | Inf | 7 |
| NewSouthWales | -46.24277 | -80 | 18.18182 | 2 | -31.610942 | -104 |
| Northern Territory | Inf | 3 | -100.00000 | -3 | NaN | 0 |
| Queensland | 108.69565 | 50 | -57.14286 | -4 | -13.235294 | -9 |
| South Australia | 96.77419 | 30 | NaN | 0 | -9.230769 | -6 |
| Tasmania | NaN | 0 | NaN | 0 | Inf | 3 |
| Victoria | 43.06569 | 59 | 366.66667 | 11 | 36.206897 | 42 |
| Western Australia | 20.00000 | 18 | 0.00000 | 0 | 21.052632 | 4 |
The rate of change in the rate of various crime victims by state
| State | 2010-2011 | rate_change |
|---|---|---|
| NewSouthWales | 34.4 | 33.8249754 |
| Victoria | 21.9 | 32.9323308 |
| Queensland | -0.8 | -0.8316008 |
| South Australia | 4.7 | 5.6085919 |
| Western Australia | 33.4 | 46.2603878 |
| Tasmania | 1.5 | 4.3103448 |
| Northern Territory | 23.3 | 43.7148218 |
| Capital | 23.3 | 43.7148218 |
On the whole, it shows an upward trend year by year recently.
The number of female victims is much higher than that of male victims, almost twice.
With the exception of sexual assault and kidnapping, the majority of victims are men.
The vast majority of cases are sexual assaults.
The number of robberies among the remaining crime categories is also considerable. (Including both armed and unarmed)
Possible reasons:
According to statistics of gender-specific crimes in various countries, male victims are the majority in almost all crimes except for sex-related crimes in which more women are victims.
| Gender | Year | sa_rate |
|---|---|---|
| Female | 2010 | 81.14353 |
| Female | 2011 | 80.92590 |
| Female | 2012 | 81.71220 |
| Female | 2013 | 83.46100 |
| Female | 2014 | 85.77439 |
| Female | 2015 | 87.63073 |
| Female | 2016 | 87.29571 |
| Female | 2017 | 88.86702 |
| Female | 2018 | 88.74093 |
| Female | 2019 | 87.99638 |
| Male | 2010 | 21.67991 |
| Male | 2011 | 23.79634 |
| Male | 2012 | 27.87459 |
| Male | 2013 | 30.70995 |
| Male | 2014 | 34.46328 |
| Male | 2015 | 38.35306 |
| Male | 2016 | 38.22735 |
| Male | 2017 | 39.55563 |
| Male | 2018 | 35.52154 |
| Male | 2019 | 33.06397 |
Take sexual assault, female victims of sexual assault make up a very high proportion of total female victims.
ABS personal safety survey also measures the number of women who contacted the police about the most recent incident within the last 10 years. Only 13.4% of women did so.
I divided age into four groups
0 -19 years old Teenage
20–34 years old Audlt
35–54 years old Elder audlt
55 years and over Elder
From graph, we can see that the trend for both teenage and adult is very similar. it has a decrease trend from 2010 to 2015. Then, it has a increse trend from 2015 to 2019. For the elder adult and elder, they have increase trend for all year.
From graph. we can see that 20-54 years age are the largest people for criminal record. The 55 year and over are the smallest group.
---
title: "Analysis of Australian victims "
author:
- familyname: Wang
othernames: Yiru
address: Monash University
email: "ywan0553@student.monash.edu"
correspondingauthor: true
qualifications: section1
- familyname: Xu
othernames: Kexin
address: Monash University
email: "kxuu0029@student.monash.edu"
qualifications: section2
correspondingauthor: true
- familyname: Tang
othernames: Ruiqi
address: Monash University
email: "rtan00062student.monash.edu"
correspondingauthor: true
qualifications: section3
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
source_code: embed
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(fig.align = "center")
```
```{r, echo = FALSE, message = FALSE, warning = FALSE}
# Libraries
library(flexdashboard)
library(tinytex)
library(gridExtra)
library(tidyverse)
library(readr)
library(bookdown)
library(knitr)
library(plotly)
library(kableExtra)
library(readxl)
```
Introduction
======================
Row
-------------------------------------
### Figure

### Figure

Row
-------------------------------------
### Introduction{data-width=500}
This report aims to analyze the changes in the victims of various crimes in Australia from 2010 to 2019. We hope to find some problems by analyzing the data: From the perspective of state, gender and age, how have the victims of various crimes changed in the past ten years?
The report is based on [victim data](https://www.abs.gov.au/statistics/people/crime-and-justice/recorded-crime-victims/latest-release) from the [Australian Bureau of Statistics](https://www.abs.gov.au/). It is a data set generated by regular judicial and criminal investigations and aims to provide the number and rate of victims across Australia in terms of state, gender and age. All ABS data displayed on this website are provided under the Creative Commons Attribution 4.0 international license. It is open data and can be shared freely and adapted for any purpose.
### Researchers{data-width=250}
*Team12 Researchers*:
- Kexin Xu
- Yiru Wang
- Ruiqi Tang
State {data-icon="fa-globe"}
=============================
Row {data-height=1000}
-------------------------------------
### Chart 1
```{r NewSouthWales}
NewSouthWales <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 3,range = "A5:AB30")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "NewSouthWales")%>%
select(Offence,Year,Count,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))
```
```{r NewSouthWales-rate,message=FALSE}
NewSouthWales_rate <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 3,range = "A31:AB41")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "NewSouthWales")%>%
select(Offence,Year,Rate,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))
```
```{r Victoria}
Victoria <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 4,range = "A5:AB28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "Victoria")%>%
select(Offence,Year,Count,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))
```
```{r Victoria_rate,message=FALSE}
Victoria_rate <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 4,range = "A29:AB37")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "Victoria")%>%
select(Offence,Year,Rate,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))
```
```{r Queensland}
Queensland <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 5,range = "A5:AB28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "Queensland")%>%
select(Offence,Year,Count,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))
```
```{r Queensland_rate,message=FALSE}
Queensland_rate <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 5,range = "A29:AB37")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "Queensland")%>%
select(Offence,Year,Rate,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))
```
```{r South_Australia}
South_Australia <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 6,range = "A5:AB30")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "South Australia")%>%
select(Offence,Year,Count,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))
```
```{r South_Australia_rate,message=FALSE}
South_Australia_rate <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 6,range = "A31:AB41")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "South Australia")%>%
select(Offence,Year,Rate,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))
```
```{r Western_Australia}
Western_Australia <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 7,range = "A5:AB30")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "Western Australia")%>%
select(Offence,Year,Count,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))
```
```{r Western_Australia_rate,message=FALSE}
Western_Australia_rate <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 7,range = "A31:AB41")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "Western Australia")%>%
select(Offence,Year,Rate,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))
```
```{r Tasmania1}
Tasmania1 <- read_excel("data/Victims_of_Crime_Extended_time_series.xls",
sheet = 8,range = "A5:AB22")%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))%>%
select(!("1993":"2009"))%>%
pivot_longer(cols = '2010':'2013',
names_to = "Year",
values_to = "Count") %>%
mutate(Count = as.double(Count))%>%
mutate(State = "Tasmania")%>%
select(Offence,Year,Count,State)
```
```{r Tasmania}
Tasmania2 <- read_excel("data/Victims_of_Crime_Extended_time_series.xls",
sheet = 8,range = "A5:AB22")%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))%>%
select(!("1993":"2013"))%>%
pivot_longer(cols = '2014':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "Tasmania")%>%
select(Offence,Year,Count,State)
Tasmania <- bind_rows(Tasmania1,Tasmania2)
```
```{r Tasmania_rate1,message=FALSE}
Tasmania_rate1 <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 8,range = "A31:AB41")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))%>%
pivot_longer(cols = '2010':'2013',
names_to = "Year",
values_to = "Rate") %>%
mutate(Rate = as.double(Rate))%>%
mutate(State = "Tasmania")%>%
select(Offence,Year,Rate,State)
```
```{r Tasmania_rate,message=FALSE}
Tasmania_rate2 <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 8,range = "A31:AB41")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))%>%
pivot_longer(cols = '2014':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "Tasmania")%>%
select(Offence,Year,Rate,State)
Tasmania_rate <- bind_rows(Tasmania_rate1,Tasmania_rate2)
```
```{r Northern_Territory}
Northern_Territory <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 9,range = "A5:AB30")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "Northern Territory")%>%
select(Offence,Year,Count,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))
```
```{r Northern_Territory_rate,message=FALSE}
Northern_Territory_rate <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 10,range = "A31:AB41")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "Northern Territory")%>%
select(Offence,Year,Rate,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))
```
```{r Capital}
Capital <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 10,range = "A5:AB30")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") %>%
mutate(State = "Capital")%>%
select(Offence,Year,Count,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction","Armed robbery"," Unarmed robbery","Blackmail/extortion"))
```
```{r Capital_rate,message=FALSE}
Capital_rate <- read_excel("data/Victims_of_Crime_Extended_time_series.xls", sheet = 10,range = "A31:AB41")%>%
rename("Offence"= "...1","2010" = "...19" , "2011" = "...20","2012" = "...21","2013"="...22","2014"="...23","2015"="...24","2016"="...25","2017"="...26","2018"="...27","2019"="...28")%>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Rate") %>%
mutate(State = "Capital")%>%
select(Offence,Year,Rate,State)%>%
filter(Offence %in%c("Murder","
Attempted murder","Manslaughter","Sexual assault","Kidnapping/abduction"))
```
```{r State}
State <- bind_rows(NewSouthWales,Victoria,Queensland,South_Australia,Western_Australia,Tasmania,Northern_Territory,Capital)
```
```{r}
State_rate <- bind_rows(NewSouthWales_rate,Victoria_rate,Queensland_rate,South_Australia_rate,Western_Australia_rate,Tasmania_rate,Northern_Territory_rate,Capital_rate)
```
```{r plot1,fig.height = 9, fig.width=10,fig.cap="Comparison of the number of victims of various crimes in each state in the same year"}
State %>%
ggplot(aes(x = Offence,
y = Count,
fill = State))+
geom_bar(stat = "identity", position = "dodge") +
ggtitle("Comparison of the number of victims of various crimes in each state in the same year") +
facet_wrap(~Year, ncol = 1,scales= "free")
```
Row {data-height=1000}
-------------------------------------
### Chart 2{data-width=500}
```{r plot2,fig.height = 8, fig.width=8, fig.cap="Rate of change in the number of victims of various crimes by state"}
State %>%
ggplot(aes( x = Year,
y = Count,
color = Offence,
group = Offence)) +
geom_line(stat = "identity") +
theme(axis.title.x =element_text(size=14), axis.title.y=element_text(size=14)) +
ggtitle("Rate of change in the number of victims of various crimes by state") +
facet_wrap(~State, ncol = 1,scales= "free")
```
### Chart 3{data-width=550}
```{r}
State_count1<-State %>%
filter(Offence == "Sexual assault")%>%
pivot_wider(id_cols = State,
names_from = Year,
values_from = Count)%>%
mutate("Sexual assault_rate" = ((`2019` - `2010`)/`2010`)*100)%>%
mutate("Sexual assault_change" = (`2019` - `2010`))%>%
select(!`2010`:`2019`)
State_count2<-State %>%
filter(Offence == "Murder")%>%
pivot_wider(id_cols = State,
names_from = Year,
values_from = Count)%>%
mutate("Murder_rate" = ((`2019` - `2010`)/`2010`)*100)%>%
mutate("Murder_change" = (`2019` - `2010`))%>%
select(!`2010`:`2019`)
State_count3<-State %>%
filter(Offence == "Armed robbery")%>%
pivot_wider(id_cols = State,
names_from = Year,
values_from = Count)%>%
mutate("robbery_rate" = ((`2019` - `2010`)/`2010`)*100)%>%
mutate("robbery_change" = (`2019` - `2010`))%>%
select(!`2010`:`2019`)
State_count4<-State %>%
filter(Offence == "Manslaughter")%>%
pivot_wider(id_cols = State,
names_from = Year,
values_from = Count)%>%
mutate("Manslaughter_rate" = ((`2019` - `2010`)/`2010`)*100)%>%
mutate("Manslaughter_change" = (`2019` - `2010`))%>%
select(!`2010`:`2019`)
State_count5<-State %>%
filter(Offence == "Kidnapping/abduction")%>%
pivot_wider(id_cols = State,
names_from = Year,
values_from = Count)%>%
mutate("Kidnapping_rate" = ((`2019` - `2010`)/`2010`)*100)%>%
mutate("Kidnapping_change" = (`2019` - `2010`))%>%
select(!`2010`:`2019`)
State_count6<-State %>%
filter(Offence == "Blackmail/extortion")%>%
pivot_wider(id_cols = State,
names_from = Year,
values_from = Count)%>%
mutate("extortion_rate" = ((`2019` - `2010`)/`2010`)*100)%>%
mutate("extortion_change" = (`2019` - `2010`))%>%
select(!`2010`:`2019`)
```
```{r table1,fig.height = 4 , fig.width=6}
state_sum1<-merge(State_count1,State_count2, by= 'State')
state_sum<-merge(State_count3,state_sum1, by= 'State')
knitr::kable(state_sum,caption = 'Ten-year rate of change in the number of victims of various crimes by state',booktabs = TRUE)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
```
```{r table2}
state_sum2<-merge(State_count4,State_count5, by= 'State')
state_sum3<-merge(State_count6,state_sum2,by= 'State')
knitr::kable(state_sum3,caption = 'Ten-year rate of change in the number of victims of various crimes by state',booktabs = TRUE)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
```
Row {data-height=600}
-------------------------------------
### Chart 4
```{r plot3,fig.height = 5 ,fig.width=7,fig.cap="The rate of change in the rate of various crime victims by state"}
State_rate %>%
filter(Offence == "Sexual assault")%>%
ggplot(aes( x = Year,
y = Rate,
color = State,
group = State)) +
geom_line(stat = "identity") +
ylab("rate-Victims per 100,000")+
theme(axis.title.x =element_text(size=14), axis.title.y=element_text(size=14)) +
ggtitle("Rate of change in the number of victims of various crimes by state")
```
### Chart 5
```{r table3}
State_rate1<-State_rate %>%
filter(Offence == "Sexual assault")%>%
pivot_wider(id_cols = State,
names_from = Year,
values_from = Rate)%>%
mutate("2010-2011" = (`2019` - `2010`))%>%
mutate("rate_change" = ((`2019` - `2010`)/`2010`)*100)%>%
select(!`2010`:`2019`)
knitr::kable(
State_rate1, booktabs = TRUE,
caption = 'A 10-year change in the proportion of victims of sexual assault')%>%
kable_styling(bootstrap_options = c("striped", "hover"))
```
Gender {data-icon="fa-user-plus"}
==================
Column{data-width=400}
--------
### Total number by gender {data-width=350}
```{r echo=FALSE}
Victims_of_Crime_raw <- readxl::read_excel("data/Victims_of_Crime_Australia.xls", sheet = 3, skip = 4, col_names = FALSE)
Victims_of_Crime <- Victims_of_Crime_raw[-1,1:11]
colnames(Victims_of_Crime) = Victims_of_Crime[1,]
Victims_of_Crime <- Victims_of_Crime[-1,]
Homicide <- Victims_of_Crime[-1,] %>%
slice(c(1:18)) %>%
filter(`Sex and age` == "Total")
Homicide[1,1] <- "Homicide_Male"
Homicide[2,1] <- "Homicide_Female"
Homicide[3,1] <- "Homicide_All"
Homicide <- Homicide %>% rename("Type_Gender" = `Sex and age`)
Murder <- Victims_of_Crime %>%
slice(c(21:38)) %>%
filter(`Sex and age` == "Total")
Murder[1,1] <- "Murder_Male"
Murder[2,1] <- "Murder_Female"
Murder[3,1] <- "Murder_All"
Murder <- Murder %>% rename("Type_Gender" = `Sex and age`)
Attemptedmurder <- Victims_of_Crime %>%
slice(c(40:57)) %>%
filter(`Sex and age` == "Total")
Attemptedmurder[1,1] <- "Attemptedmurder_Male"
Attemptedmurder[2,1] <- "Attemptedmurder_Female"
Attemptedmurder[3,1] <- "Attemptedmurder_All"
Attemptedmurder <- Attemptedmurder %>% rename("Type_Gender" = `Sex and age`)
Manslaughter <- Victims_of_Crime %>%
slice(c(59:76)) %>%
filter(`Sex and age` == "Total")
Manslaughter[1,1] <- "Manslaughter_Male"
Manslaughter[2,1] <- "Manslaughter_Female"
Manslaughter[3,1] <- "Manslaughter_All"
Manslaughter <- Manslaughter %>% rename("Type_Gender" = `Sex and age`)
Sexualassault <- Victims_of_Crime %>%
slice(c(78:110)) %>%
filter(`Sex and age` == "Total")
Sexualassault[1,1] <- "Sexualassault_Male"
Sexualassault[2,1] <- "Sexualassault_Female"
Sexualassault[3,1] <- "Sexualassault_All"
Sexualassault <- Sexualassault %>% rename("Type_Gender" = `Sex and age`)
Kidnappingabduction <- Victims_of_Crime %>%
slice(c(112:141)) %>%
filter(`Sex and age` == "Total")
Kidnappingabduction[1,1] <- "Kidnappingabduction_Male"
Kidnappingabduction[2,1] <- "Kidnappingabduction_Female"
Kidnappingabduction[3,1] <- "Kidnappingabduction_All"
Kidnappingabduction <- Kidnappingabduction %>% rename("Type_Gender" = `Sex and age`)
Robbery <- Victims_of_Crime %>%
slice(c(143:175)) %>%
filter(`Sex and age` == "Total")
Robbery[1,1] <- "Robbery_Male"
Robbery[2,1] <- "Robbery_Female"
Robbery[3,1] <- "Robbery_All"
Robbery <- Robbery %>% rename("Type_Gender" = `Sex and age`)
Armedrobbery <- Victims_of_Crime %>%
slice(c(177:209)) %>%
filter(`Sex and age` == "Total")
Armedrobbery[1,1] <- "Armedrobbery_Male"
Armedrobbery[2,1] <- "Armedrobbery_Female"
Armedrobbery[3,1] <- "Armedrobbery_All"
Armedrobbery <- Armedrobbery %>% rename("Type_Gender" = `Sex and age`)
Unarmedrobbery <- Victims_of_Crime %>%
slice(c(211:243)) %>%
filter(`Sex and age` == "Total")
Unarmedrobbery[1,1] <- "Unarmedrobbery_Male"
Unarmedrobbery[2,1] <- "Unarmedrobbery_Female"
Unarmedrobbery[3,1] <- "Unarmedrobbery_All"
Unarmedrobbery <- Unarmedrobbery %>% rename("Type_Gender" = `Sex and age`)
Blackmailextortion <- Victims_of_Crime %>%
slice(c(245:274)) %>%
filter(`Sex and age` == "Total")
Blackmailextortion[1,1] <- "Blackmailextortion_Male"
Blackmailextortion[2,1] <- "Blackmailextortion_Female"
Blackmailextortion[3,1] <- "Blackmailextortion_All"
Blackmailextortion <- Blackmailextortion %>% rename("Type_Gender" = `Sex and age`)
Victims_of_Crime_tidy <- bind_rows(Homicide, Murder, Attemptedmurder, Manslaughter, Sexualassault, Kidnappingabduction, Robbery, Armedrobbery, Unarmedrobbery, Blackmailextortion) %>%
mutate(`2010` = as.numeric(`2010`)) %>%
pivot_longer(cols = -Type_Gender,
names_to = "Year",
values_to = "Number") %>%
separate(col = Type_Gender,
into = c("Type", "Gender"), "_") %>%
filter(!Type == "Homicide",
!Type == "Robbery")
```
```{r echo=FALSE}
g <- Victims_of_Crime_tidy %>%
group_by(Year, Gender) %>%
summarise(sum = sum(Number)) %>%
ggplot(aes(x = Year,
y = sum,
color = Gender,
group = Gender)) +
geom_line() +
theme_bw() +
scale_color_brewer(palette = "Dark2") +
theme(legend.position = "bottom")
ggplotly(g)
```
### Analysis{data-width=250}
* On the whole, it shows an upward trend year by year recently.
* The number of female victims is much higher than that of male victims, almost twice.
* With the exception of sexual assault and kidnapping, the majority of victims are men.
* The vast majority of cases are sexual assaults.
* The number of robberies among the remaining crime categories is also considerable. (Including both armed and unarmed)
* Possible reasons:
+ Women generally have stronger safety awareness
+ Women are less likely to be seen alone at night in areas where they are likely to be robbed
According to statistics of gender-specific crimes in various countries, male victims are the majority in almost all crimes except for sex-related crimes in which more women are victims.
Column{data-width=400}
---------------
### Number by gender by crime type {data-width=400}
```{r fig.height = 8, echo=FALSE}
Victims_of_Crime_tidy %>%
ggplot() +
geom_col(aes(x = Year,
y = Number,
fill = Gender),
position = "dodge") +
facet_grid(Type~., scales = "free_y") +
scale_fill_brewer(palette = "Dark2") +
theme_bw()
```
### Sexual assault proportion {data-width=450}
```{r echo=FALSE}
Victims_of_Crime_sum <- Victims_of_Crime_tidy %>%
filter(!Gender == "All") %>%
group_by(Gender, Year) %>%
summarise(sum = sum(Number))
Victims_of_Crime_tidy %>%
filter(Type == "Sexualassault" &
!Gender == "All") %>%
left_join(Victims_of_Crime_sum) %>%
group_by(Gender, Year) %>%
summarise(sa_rate = Number/sum*100) %>%
kable(caption = "Sexual Assault Rate") %>%
kable_styling(bootstrap_options = c("striped", "hover"))
```
Take sexual assault, female victims of sexual assault make up a very high proportion of total female victims.
Column{data-width=400}
-----------
### Rate by gender{data-width=350}
```{r echo=FALSE}
Victims_of_Crime1 <- Victims_of_Crime_raw[-1,c(1, 12:21)]
colnames(Victims_of_Crime1) = Victims_of_Crime1[1,]
Victims_of_Crime1 <- Victims_of_Crime1[-1,]
Sexualassault1 <- Victims_of_Crime1 %>%
slice(c(78:110)) %>%
filter(`Sex and age` == "Total")
Sexualassault1[1,1] <- "Sexualassault_Male"
Sexualassault1[2,1] <- "Sexualassault_Female"
Sexualassault1[3,1] <- "Sexualassault_All"
Sexualassault1 <- Sexualassault1 %>% rename("Type_Gender" = `Sex and age`)
Sexualassault_rate <- Sexualassault1 %>%
mutate(`2010` = as.numeric(`2010`)) %>%
pivot_longer(cols = -Type_Gender,
names_to = "Year",
values_to = "Rate") %>%
separate(col = Type_Gender,
into = c("Type", "Gender"), "_") %>%
filter(!Gender == "All")
```
```{r echo=FALSE, fig.height=3, fig.width=5}
sa <- Sexualassault_rate %>%
ggplot() +
geom_col(aes(x = Year,
y = Rate,
fill = Gender),
position = "dodge") +
theme_bw() +
scale_fill_brewer(palette = "Dark2") +
theme(legend.position = "bottom")
ggplotly(sa)
```
### Analysis
* Rate is calculated by victim number divided by 100,000 persons.
* Show an upward pattern over years.
* Higher than 0.15% in recent years which means 3 out of every 2,000 people have been sexually assaulted.
* Possible reasons:
+ Women are physically vulnerable
+ Men are more sexually impulsive
+ Many women may choose not to report the crime
- relationship to the offender
- confidence in the justice system
- fear of revenge
- public opinion
ABS personal safety survey also measures the number of women who contacted the police about the most recent incident within the last 10 years. Only 13.4% of women did so.
Age {data-icon="fa-user-times"}
====================
Row {data-height=200}
----------------------------------
```{r, echo = FALSE, message = FALSE, warning = FALSE}
Homicide <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A20", dim = c(6,11)))
colnames(Homicide) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Murder <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A39", dim = c(6,11)))
colnames(Murder) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Attempted_murder <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A58", dim = c(6,11)))
colnames(Attempted_murder) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Manslaughter <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A77", dim = c(6,11)))
colnames(Manslaughter) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Sexual_assault <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A106", dim = c(10,11)))
colnames(Sexual_assault) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Kidnapping_abduction <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A138", dim = c(9,11)))
colnames(Kidnapping_abduction) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Robbery <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A171", dim = c(10,11)))
colnames(Robbery) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Armed_robbery <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A205", dim = c(10,11)))
colnames(Armed_robbery) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Unarmed_robbery <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A239", dim = c(10,11)))
colnames(Unarmed_robbery) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
Blackmail_extortion <- read_excel("data/Victims_of_Crime_Australia.xls",
sheet = "Table 2", range = anchored("A271", dim = c(9,11)))
colnames(Blackmail_extortion) <- c("age" ,2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019)
```
```{r Homicide, echo = FALSE, message = FALSE, warning = FALSE}
Homicide %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> homicide_long
homicide_long %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(Year = as_factor(Year)) %>%
mutate(class = "Homicide") -> homicide_wider
homicide_long %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Homicide") %>%
filter(age != "Total") -> homicide_age
homicide_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Homicide")-> p1
```
``` {r Murder, echo = FALSE, message = FALSE, warning = FALSE}
Murder %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> murder_longer
murder_longer %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(Year = as_factor(Year)) %>%
mutate(class = "Murder") -> murder_wider
murder_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Murder") %>%
filter(age != "Total") -> murder_age
murder_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Murder") -> p2
```
``` {r Attempted_murder, echo = FALSE, message = FALSE, warning = FALSE}
Attempted_murder %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> AM_longer
AM_longer %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(class = "Attempted") -> AM_wider
AM_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Attempted") %>%
filter(age != "Total") -> am_age
am_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Attempted_murder") -> p3
```
``` {r Manslaughter, echo = FALSE, message = FALSE, warning = FALSE}
Manslaughter %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> manslaughter_longer
manslaughter_longer %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(Year = as_factor(Year)) %>%
mutate(class = "Manslaughter") -> manslaughter_wider
AM_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Manslaughter") %>%
filter(age != "Total") -> manslaughter_age
manslaughter_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Manslaughter") -> p4
```
``` {r Sexual_assault, echo = FALSE, message = FALSE, warning = FALSE}
Sexual_assault %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> SA_longer_edit
SA_longer_edit %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) -> SA_wider_edit
SA_wider_edit %>%
mutate(
`0–19 years` = `0–9 years` + `10–14 years` + `15–19 years`,
`20–34 years` = `20–24 years` + `25–34 years`,
`35–54 years` = `35–44 years` + `45–54 years`,
`55 years and over` = `55–64 years`+`55–64 years`+ `65 years and over`
) %>%
select(Year, `0–19 years`:`55 years and over`) -> SA_wider
SA_wider %>%
pivot_longer(cols = -Year, names_to = "age", values_to = "Count") %>%
mutate(class = "Sexual") -> SA_longer
SA_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Sexual") %>%
filter(age != "Total") -> SA_age
SA_age%>%
ggplot() + geom_col(aes(x = age ,y = sum, fill = age)) +
ggtitle("Sexual assault") -> p5
```
``` {r Kidnapping_abduction, echo = FALSE, message = FALSE, warning = FALSE}
Kidnapping_abduction %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> ka_longer_edit
ka_wider_edit <- ka_longer_edit %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count)
ka_wider_edit %>%
mutate(
`0–19 years` = `0–9 years` + `10–14 years` + `15–19 years`,
`20–34 years` = `20–24 years` + `25–34 years`,
`35–54 years` = `35–44 years` + `45–54 years`,
`55 years and over` = `55 years and over`
) %>%
select(Year, `0–19 years`, `20–34 years`, `35–54 years`, `55 years and over`) -> ka_wider
ka_wider %>%
pivot_longer(cols = -Year, names_to = "age", values_to = "Count") -> ka_longer
ka_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Kidnapping") %>%
filter(age != "Total") -> ka_age
ka_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Kidnapping abduction") -> p6
```
``` {r Robber, echo = FALSE, message = FALSE, warning = FALSE}
Robbery %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> Robbery_longer_edit
Robbery_longer_edit %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(Year = as_factor(Year)) %>%
mutate(class = "robbery") -> Robbery_wider_edit
Robbery_wider_edit %>%
mutate(
`0–19 years` = `0–9 years` + `10–14 years` + `15–19 years`,
`20–34 years` = `20–24 years` + `25–34 years`,
`35–54 years` = `35–44 years` + `45–54 years`,
`55 years and over` = `55–64 years`+`55–64 years`+ `65 years and over`
) %>%
select(Year, `0–19 years`:`55 years and over`) -> Robbery_wider
Robbery_wider %>%
pivot_longer(cols = -Year, names_to = "age", values_to = "Count") %>%
mutate(class = "robbery") -> Robbery_longer
Robbery_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "robbery") %>%
filter(age != "Total") -> robbery_age
robbery_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Robber") -> p7
```
``` {r Armed_robbery, echo=FALSE, message = FALSE, warning = FALSE}
Armed_robbery %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> AR_longer_edit
AR_longer_edit %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(Year = as_factor(Year)) -> AR_wider_edit
AR_wider_edit %>%
mutate(
`0–19 years` = `0–9 years` + `10–14 years` + `15–19 years`,
`20–34 years` = `20–24 years` + `25–34 years`,
`35–54 years` = `35–44 years` + `45–54 years`,
`55 years and over` = `55–64 years`+`55–64 years`+ `65 years and over`
) %>%
select(Year, `0–19 years`:`55 years and over`) -> AR_wider
AR_wider %>%
pivot_longer(cols = -Year, names_to = "age", values_to = "Count") %>%
mutate(class = "Armed") -> AR_longer
AR_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Armed") %>%
filter(age != "Total") -> AR_age
AR_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Armed robbery") -> p8
```
``` {r Unarmed_robbery, echo = FALSE, message = FALSE, warning = FALSE}
Unarmed_robbery %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> UR_longer_edit
UR_longer_edit %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(Year = as_factor(Year)) %>%
mutate(class = "Unarmed") -> UR_wider_edit
UR_wider_edit %>%
mutate(
`0–19 years` = `0–9 years` + `10–14 years` + `15–19 years`,
`20–34 years` = `20–24 years` + `25–34 years`,
`35–54 years` = `35–44 years` + `45–54 years`,
`55 years and over` = `55–64 years`+`55–64 years`+ `65 years and over`
) %>%
select(Year, `0–19 years`:`55 years and over`) -> UR_wider
UR_wider %>%
pivot_longer(cols = -Year, names_to = "age", values_to = "Count") %>%
mutate(class = "Unarmed") -> UR_longer
UR_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Unarmed") %>%
filter(age != "Total") -> UR_age
UR_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Unarmed robbery") -> p9
```
``` {r Blackmail_extortion, echo = FALSE, message = FALSE, warning = FALSE}
Blackmail_extortion %>%
pivot_longer(cols = '2010':'2019',
names_to = "Year",
values_to = "Count") -> BE_longer_edit
BE_longer_edit %>%
pivot_wider(id_cols = c(age, Year, Count), names_from = age, values_from = Count) %>%
mutate(Year = as_factor(Year)) %>%
mutate(class = "Blackmail") -> BE_wider_edit
BE_wider_edit %>%
mutate(
`0–19 years` = `0–14 years` + `15–19 years`,
`20–34 years` = `20–24 years` + `25–34 years`,
`35–54 years` = `35–44 years` + `45–54 years`,
`55 years and over` = `55–64 years`+`55–64 years`+ `65 years and over`
) %>%
select(Year, `0–19 years`:`55 years and over`) -> BE_wider
BE_wider %>%
pivot_longer(cols = -Year, names_to = "age", values_to = "Count") %>%
mutate(class = "Blackmail") -> BE_longer
BE_longer %>%
group_by(age) %>%
summarise(sum = sum(Count)) %>%
mutate(class = "Blackmail") %>%
filter(age != "Total") -> BE_age
BE_age %>%
ggplot() + geom_col(aes(x= age, y = sum, fill = age)) +
ggtitle("Blackmail_extortion") -> p10
```
```{r}
homicide_age %>%
full_join(robbery_age, key = age, by = c("age", "sum", "class"))%>%
full_join(ka_age, key = age, by = c("age", "sum", "class")) %>%
full_join(am_age, key = age, by = c("age", "sum", "class")) %>%
full_join(murder_age, key = age, by = c("age", "sum", "class")) %>%
full_join(manslaughter_age, key = age, by = c("age", "sum", "class")) %>%
full_join(SA_age, key = age, by = c("age", "sum", "class")) %>%
full_join(AR_age, key = age, by = c("age", "sum", "class")) %>%
full_join(UR_age, key = age, by = c("age", "sum", "class")) %>%
full_join(BE_age, key = age, by = c("age", "sum", "class"))-> data
```
```{r}
AM_wider$`0–19 years` + AR_wider$`0–19 years`+ BE_wider$`0–19 years` + homicide_wider$`0–19 years` + ka_wider$`0–19 years` + manslaughter_wider$`0–19 years`+murder_wider$`0–19 years`+Robbery_wider$`0–19 years` + SA_wider$`0–19 years`+ UR_wider$`0–19 years` -> teenage
AM_wider$`20–34 years` + AR_wider$`20–34 years` + BE_wider$`20–34 years` + homicide_wider$`20–34 years` + ka_wider$`20–34 years` + manslaughter_wider$`20–34 years` + murder_wider$`20–34 years` + Robbery_wider$`20–34 years` + SA_wider$`20–34 years` + UR_wider$`20–34 years` -> adult
AM_wider$`35–54 years` + AR_wider$`35–54 years` + BE_wider$`35–54 years` + homicide_wider$`35–54 years` + ka_wider$`35–54 years` + manslaughter_wider$`35–54 years` + murder_wider$`35–54 years` + Robbery_wider$`35–54 years` + SA_wider$`35–54 years` + UR_wider$`35–54 years` -> elder_adult
AM_wider$`55 years and over` + AR_wider$`55 years and over` + BE_wider$`55 years and over` + homicide_wider$`55 years and over` + ka_wider$`55 years and over` + manslaughter_wider$`55 years and over` + murder_wider$`55 years and over` + Robbery_wider$`55 years and over` + SA_wider$`55 years and over` + UR_wider$`55 years and over` -> elder
```
### Age Group
I divided age into four groups
* 0 -19 years old Teenage
* 20–34 years old Audlt
* 35–54 years old Elder audlt
* 55 years and over Elder
Row
----------------------------------
### Trend
```{r}
Year <- 2010:2019
tibble(Year, teenage, adult, elder_adult, elder) -> age_total
age_total %>%
mutate(Year = as.numeric(Year)) -> age
ggplot() +
geom_line(aes(x=Year, y = teenage), data =age %>% select(Year, teenage)) +
ggtitle("Teenage") -> p_teenage
ggplot() +
geom_line(aes(x=Year, y = adult), data = age %>% select(Year, adult)) +
ggtitle("adult") -> p_adult
ggplot() +
geom_line(aes(x=Year, y = elder_adult), data = age %>% select(Year, elder_adult)) +
ggtitle("elder_adult") -> p_elder_adult
ggplot() +
geom_line(aes(x=Year, y = elder), data =age %>% select(Year, elder)) +
ggtitle("elder") -> p_elder
grid.arrange(p_teenage, p_adult, p_elder_adult, p_elder)
```
Row {data-height=80}
----------------------------------
### Analysis
From graph, we can see that the trend for both teenage and adult is very similar. it has a decrease trend from 2010 to 2015. Then, it has a increse trend from 2015 to 2019. For the elder adult and elder, they have increase trend for all year.
Row
----------------------------------
### Age and Class
```{r}
data %>%
ggplot() + geom_col(aes(x= class, y = sum, fill = age), position = "fill") -> p_hist
plotly::ggplotly(p_hist)
```
Row
----------------------------------
### Analysis
From graph. we can see that 20-54 years age are the largest people for criminal record. The 55 year and over are the smallest group.
Row
--------------------------------------
```{r}
p1
```
```{r}
p2
```
```{r}
p3
```
Row
--------------------------------------
```{r}
p4
```
```{r}
p5
```
```{r}
p6
```
Row
--------------------------------------
```{r}
p7
```
```{r}
p8
```
```{r}
p9
```
Row
--------------------------------------
```{r}
p10
```